<?php
/**
 * @package      nuo
 * @subpackage   nuo.viewer
 * @author       Nam Nguyen <nam.ngvan@gmail.com>
 * @version      1.0
 * @since        Apr 18, 2013
 */
interface Nuo_User_Interface
{

	/**
	 * Get display name
	 * @access   public
	 * @return   string
	 */
	function getTitle();

	/**
	 * Get viewer user id
	 * @access    public
	 * @return   int
	 */
	function getId();

	/**
	 * Is Member ?
	 * @access   public
	 * @return   bool
	 */
	function isMember();
	
	/**
	 * Is Member ?
	 * @access   public
	 * @return   bool
	 */
	function isGuest();

	/**
	 * @access   public
	 * @param    Object  $object
	 * @return   bool
	 */
	function isOwner($object);

	/**
	 * Get Permission
	 * @access    public
	 * @return    mixed
	 */
	function getAcl();
	
	/**
	 * Set new permission value associate with action
	 * WARNING:
	 * + Do not store this value to database
	 * + To store new value, use permission api instead
	 * @access  public
	 * @param   string  $action
	 * @param   mixed   $value
	 * @return  Nuo_Permission
	 */
	function setAllow($action, $value);

	/**
	 * Get permission of this action
	 * @access public  int
	 * @param  string  $action
	 * @return mixed
	 */
	function allow($action);

	/**
	 * Required user to allow to action.
	 * + If user has authorized to do "action", return true
	 * + If user has no permission to pass "action", redirect user to login required
	 * or permission deined page.
	 * + If you want to get permission instead of required user, please use
	 * ":allow()" instead of this method.
	 * @access  public
	 * @param   string   $action
	 * @param   int      $def
	 * @return  void
	 */
	function required($action);

}
